-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Optimize array_slice for packed/unpacked arrays with large offsets #4860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nikic
reviewed
Oct 25, 2019
Also, I should probably make the same optimization for $preserve_keys=true - It'd be inconsistent to have one be thousands of times slower than the other. |
8af7046
to
602d104
Compare
The review comments have been addressed. The build failure was due to a mac OS job encountering a networking issue. |
nikic
reviewed
Oct 26, 2019
nikic
reviewed
Oct 26, 2019
nikic
reviewed
Oct 26, 2019
If the offset is 100000, and there are no gaps in the packed/unpacked array, then advance the pointer once by 100000, instead of looping and skipping 100000 times. Add a new test of array_slice handling unset offsets.
afa3dfb
to
c6c0eb8
Compare
nikic
reviewed
Oct 26, 2019
nikic
approved these changes
Oct 26, 2019
TysonAndre
added a commit
to TysonAndre/php-src
that referenced
this pull request
Oct 29, 2019
Fix folding for the new helper method. Clarify comment in UPGRADING: The performance on associative arrays would also improve, as long as no offsets were unset (no gaps). Packed arrays can have gaps.
php-pulls
pushed a commit
that referenced
this pull request
Oct 30, 2019
Fix folding for the new helper method. Clarify comment in UPGRADING: The performance on associative arrays would also improve, as long as no offsets were unset (no gaps). Packed arrays can have gaps. Closes GH-4873. [ci skip]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the offset is 100000, and there are no gaps in the packed array,
then advance the pointer once by 100000(1+99999),
instead of looping and skipping 100000 times.
This was validated with this test script. Unit tests continue to pass locally: